<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../css/api.css" />
		<link rel="stylesheet" type="text/css" href="../../css/style.css" />
		<link rel="stylesheet" type="text/css" href="../../css/btnplus.css" />
		<style type="text/css">
			html,body{ height:100%; }
			.login_form{ padding: 114px 15px 0;}
			.login_form .form li{ margin-top: 22px; padding: 0;}
			.login_form b{ display: block; font-size: 25px; font-weight: 500; color:#333; line-height: 80px;}
			.login_form .form p{ margin-right: 15px;}
			.login_form em{ display:block; line-height: 42px; color: #474747; font-size: 14px;}
			.login_form em a{ color:#474747;}
			.login_form .btn{ padding-left: 0; padding-right: 0;}

			.login_other{ padding: 0 10px 20px;}
			.login_other h2{ display:block; text-align: center; font-size: 12px; color: #808080; font-weight: 400; line-height: 50px; position: relative; overflow: hidden;}
			.login_other h2::after{ position:absolute; content: ""; left: 0; right: 0; top: 50%; border-top: 1px #d0d0d0 solid; transform: scaleY(0.5); z-index: 1;}
			.login_other h2 i{ display:inline-block; vertical-align: top; position: relative; height: 50px; background-color: #fff; padding: 0 10px; z-index: 2;}
			.login_other ul{ padding: 0 20px;}
			.login_other a{ float: left; width: 50%; text-align: center; font-size: 14px; color: #333; line-height: 40px;}
			.login_other a i{ display:inline-block; vertical-align: top; background-position: left center; background-repeat: no-repeat; background-size: 22px auto; padding-left: 30px;}
			.login_other p{ text-align: center; font-size: 12px; color: #333; line-height: 20px; padding-top: 15px;}
			.login_other p i{ display:inline; color: #3262F1 !important; }
			.fr i { color:#78D49A; }
			.update_pwd .form li{ padding: 0; position: relative;}
			.update_pwd .form li:not(:last-child)::after{position: absolute; content: ""; left: 0; right: 0; bottom: 0; border-bottom: 1px #d4d4d4 solid; transform: scaleY(0.5);}
			.update_pwd .form p{ font-size: 14px; color: #333; line-height: 42px;}
			.update_pwd .form input{ display:block; border: 0; font-size: 14px; color: #474747; padding: 13px 0; width: 100%; background-color: transparent; border-radius: 0;}
			.update_pwd .form button{ display:block; border: 0; font-size: 14px; color: #333; height: 42px; background-color: transparent; border-radius: 0;}
			.update_pwd .form button i{ color: #3262F1; }
			.update_pwd .form span{ display:block; font-size: 12px; color: #999; line-height: 30px;}
			.update_pwd .btn{ padding: 20px 0;}
			.disable-btn { color:#ccc !important; }
			.display-none { display:none; }
		</style>
	</head>
	<body>
		<div class="update_pwd login_form">
			<b id="title">欢迎登录运运满</b>
			<ul class="form">
				<li>
					<div class="m_cell_hd"><p id="qianzhui" style="margin-bottom:1px;">+86</p></div>
					<div class="m_cell_ft m_cell_primary"><input type="text" name="mobile" id="mobile" value="" placeholder="请输入手机号" readonly /></div>
				</li>
				<li>
					<div class="m_cell_hd m_cell_primary"><input type="password" name="password" id="password" value="" placeholder="请输入密码，至少6位" readonly /></div>
					<div class="m_cell_ft"><button id="btnforgetsms" tapmode onclick="forgetorsms(this);">忘记密码</button></div>
				</li>
				<li class="clearfix" style="margin-top:10px;">
					<em class="fl"><a href="javascript:;" tapmode onclick="changetype(this);">短信快捷登录</a></em>
					<em class="fr"><a href="javascript:;" tapmode onclick="regorforget(this);" id="btnregforget">没有账号？<i>点击注册</i></a></em>
				</li>
			</ul>
			<ul class="btn">
				<button class="d_btn" id="login-btn" tapmode="btnpress" onclick="login();">登录</button>
			</ul>
		</div>
		<!--登录end-->

		<!--三方登录start-->
		<div class="login_other">
			<h2><i>第三方登录</i></h2>
			<ul class="clearfix">
				<a href="javascript:;" tapmode onclick="wxlogin();" id="wxbtn"><i style="background-image: url(../../image/img_31.png)">微信登录</i></a>
				<a href="javascript:;" tapmode onclick="qqlogin();" id="qqbtn"><i style="background-image: url(../../image/img_30.png)">QQ登录</i></a>
			</ul>
			<p tapmode onclick="openNavWin('#70CFD1','terms_win','terms_frm.html','用户协议',false,false,true,[],{});">登录即代表阅读并同意<i>用户协议<i></p>
		</div>
		<!--三方登录end-->
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/app.js"></script>
	<script type="text/javascript" src="../../script/md5.js"></script>
	<script type="text/javascript" src="../../script/permission.js"></script>
	<script type="text/javascript">
		var logintype = 1; //1密码登录；2验证码登录。默认密码登录
		var UIInput;
		var curPwdinputId = 0;
		
		var isrun = 0; //变量控制是否可以点击发短信按钮
		var keyboardId = 0;//当前键盘ID
		var InterValObj; //timer变量，控制时间
		var count = 60; //间隔函数，1秒执行
		var curCount;//当前剩余秒数
		var qq;
		var wx;
		apiready = function() {
			api.parseTapmode();
			var posT = $api.offset($api.byId('login-btn')).t;
			var topheight = api.winHeight - posT - 230;
			$api.css($api.dom('.login_other'),'padding-top:'+topheight+'px');
			UIInput = api.require('UIInput');
			fnInitUIInput(); //初始UIinput打开
			qq = api.require('QQPlus');
			wx = api.require('wx');
			if (api.systemType == "ios") {
				//$api.addCls($api.dom('.login_other'),'display-none');
			}
			qq.installed(function(ret, err) {
				if (ret.status) {
					//api.alert({ msg: "安装" });
				} else {
					$api.remove($api.byId('qqbtn'));
				}
			});
			wx.isInstalled(function(ret, err) {
				if (ret.installed) {
					//alert("当前设备已安装微信客户端");
				} else {
					$api.remove($api.byId('wxbtn'));
				}
			});
			var rong = api.require('rongCloud2');
			rong.logout(function(ret, err) {
				console.log(JSON.stringify(err));
				if (ret.status == 'success')
				{
				}
			}); // 断开，且不再
			api.addEventListener({
				name : 'keyback'
			}, function(ret, err) {
				api.toast({
					msg : '再点一下退出应用',
					duration : 2000,
					location : 'bottom'
				});
				api.addEventListener({
					name : 'keyback'
				}, function(ret, err) {
					api.closeWidget({
						silent : true
					});
				});
				setTimeout(function() {
					exitApp();
				}, 2000)
			});
			setTimeout(function() {
				api.removeLaunchView({
					animation : {
						type : 'fade',
						duration : 500
					}
				});
			}, 500);
		}
		function testface() {
			//人脸识别
			var demo = api.require('baiduFaceLive');
			demo.openFaceDetectView({
				rect: {
					x: 0,
					y: 0,
					w : api.winWidth,
					h : api.winHeight,
				},
			
			}, function(ret, err){
				if(ret.evenType=='success'){
					//由于base64数据量大，请不要用JSON.stringify(ret)调试
					alert('验证成功');
					
					
					
					
				}else if(ret.evenType=='Tips'){
					toast(ret.message);
				}else{
					//api.showtoast("warning",{ msg : JSON.stringify(ret) +"  "+JSON.stringify(err)});
				}
			});
		}
		function exitApp() {
			api.addEventListener({
				name : 'keyback'
			}, function(ret, err) {
				api.toast({
					msg : '再点一下退出应用',
					duration : 2000,
					location : 'bottom'
				});
				api.addEventListener({
					name : 'keyback'
				}, function(ret, err) {
					api.closeWidget({
						id : api.appId,
						retData : {
							name : 'closeWidget'
						},
						silent : true
					});
				});
				setTimeout(function() {
					exitApp();
				}, 3000)
			});
		}
		function forgetorsms(obj) {
			//判断打开忘记密码或者发送短信
			if($api.text(obj) == '忘记密码')
			{
				//打开忘记密码页面
				openNavWin('#ddd','forgetPwd_win','forgetPwd_frm.html','',false,false,true,[],{});
			}
			else
			{
				sendMessage();
			}
		}
		function regorforget(obj) {
			//判断打开注册或者忘记密码
			if($api.text(obj) == '忘记密码')
			{
				//打开忘记密码页面
				openNavWin('#ddd','forgetPwd_win','forgetPwd_frm.html','',false,false,true,[],{});
			}
			else
			{
				openNavWin('#ddd','reg_win','reg_frm.html','注册账号',false,false,true,[],{});
			}
		}
		function changetype(obj) {

			$api.val($api.byId('password'),'');
			if($api.text(obj) == '密码登录')
			{
				logintype = 1;
				$api.text($api.byId('title'),'欢迎登录运运满');
				$api.text(obj,'短信快捷登录');
				$api.html($api.byId('btnforgetsms'),'忘记密码');
				$api.html($api.byId('btnregforget'),'没有账号？<i>点击注册</i>');
			}
			else
			{
				logintype = 2;
				$api.text($api.byId('title'),'短信登录');
				$api.text(obj,'密码登录');
				$api.html($api.byId('btnforgetsms'),'<i>获取验证码</i>');
				$api.html($api.byId('btnregforget'),'忘记密码');
			}
			
			changeinput();
		}
		function threelogin(wbuid,bindtype) {
			api.showProgress({
				title: '请稍后...',
				text: '',
				modal: true
			});
			var paramsObj = {
				app_key: kAppKey,
				bindtype: bindtype,
				token: wbuid
			}
			var _sign = getSign(paramsObj, kAppKey, kAppSecret);
			paramsObj.signature = _sign;
			api.ajax({
				url: ApiUrl + '/v1/token/bindcheck',
				method: 'post',
				data: {
					values: paramsObj
				}
			}, function(ret, err) {
				api.hideProgress();
				if (ret) {
					if(ret.data.client.status==4)
					{
						api.alert({ title: '账号无法登录', msg: '您的账户已禁用！' });
					}
					else if(ret.data.client.status==-1)
					{
						var access_token = ret.data.access_token;
						var rongcloud_token = ret.data.client.rongcloud_token;
						var credit = ret.data.client.credit;
						var userjson = {
							access_token : access_token,
							rongcloud_token: rongcloud_token,
							uid: ret.data.client.uid,
							realname: ret.data.client.realname,
							credit: credit,
							avatar: ret.data.client.avatar,
							mobile: ret.data.client.mobile,
							status: ret.data.client.status,
							usertype: ret.data.client.usertype
						};
						checkface(userjson);
						//未人脸识别的进行人脸识别
					}
					else
					{
						var access_token = ret.data.access_token;
						var rongcloud_token = ret.data.client.rongcloud_token;
						var credit = ret.data.client.credit;
						var userjson = {
							access_token : access_token,
							rongcloud_token: rongcloud_token,
							uid: ret.data.client.uid,
							realname: ret.data.client.realname,
							credit: credit,
							avatar: ret.data.client.avatar,
							mobile: ret.data.client.mobile,
							status: ret.data.client.status,
							usertype: ret.data.client.usertype
						};
						api.setPrefs({
							key: 'user_info',
							value: userjson
						}, function(ret, err) {
							//closeWin();
						});
						api.sendEvent({
							//刷新主页相关页面逻辑
							name : 'refreshindex',
							extra : {
								userjson : userjson
							}
						});
						api.sendEvent({
							name : 'updateuser',
							extra : {
								userjson : userjson
							}
						});
						
						api.closeToWin({
							name: 'root'
						});
					}
				}
				else
				{
					if(err.body.code == '405')
					{
						var param = {
							bindtype: bindtype,
							token: wbuid
						};
						openNavWin('#ddd','bind_win','bind_frm.html','',false,false,true,[],param);
					}
					else
					{
						toast(err.body.message);
					}
				}
			});	
		}
		function qqlogin() {
			api.showProgress({
				title: '登录中...',
				text: '',
				modal: true
			});
			setTimeout(function() {
				api.hideProgress();
			}, 1000);
			qq.login(function(ret, err) {
				if (ret.status) {
					threelogin(ret.openId,'qq');
				}
				else
				{
					toast("登录失败，请重试");
				}
			});
		}
		function wxlogin() {
			api.showProgress({
				title: '登录中...',
				text: '',
				modal: true
			});
			setTimeout(function() {
				api.hideProgress();
			}, 2000);
			wx.auth({
				apiKey: ''
			}, function(ret, err) {
				if (ret.status) {
					//alert(JSON.stringify(ret));
					wx.getToken({
						apiKey: '',
						apiSecret: '',
						code: ret.code
					}, function(ret, err) {
						if (ret.status) {
							//alert(JSON.stringify(ret));
							api.ajax({
								url: 'https://api.weixin.qq.com/sns/userinfo?access_token='+ret.accessToken+'&openid='+ret.openId+'&lang=zh_CN',
								method: 'get',
								cache: false
							}, function(ret, err) {
								api.hideProgress();
								if(ret)
								{
									console.log(JSON.stringify(ret));
									threelogin(ret.openid,'wx');									
								}
								else
								{
									toast("登录失败，请重试");
									//api.alert({ msg: JSON.stringify(err) });
								}
								//console.log(JSON.stringify(ret));
							});
							
						} else {
							api.hideProgress();
							toast("未知错误");
						}
					});
				} else {
					//alert(JSON.stringify(err));
					api.hideProgress();
					toast("取消登录");
				}
			});
		}
		
		function sendMessage() {
			if(isrun == 1)
			{
				return false;
			}
			
			hideInput();//收起键盘
			//发送验证码
		  　curCount = count;
			var mobile = $api.val($api.byId('mobile'));
			if (!mobile) {
				toast('请输入手机号码');
				return false;
			}
			//if (mobile.search(/^([0-9]{11})?$/) == -1) {
			if(!(/^1[3|4|5|6|7|8|9][0-9]\d{8}$/.test(mobile))) {
				toast('手机号格式错误');
				return false;
			}
		　　//设置button效果，开始计时
			//$api.attr($api.byId('btnSendCode'),'disabled','true');
			$api.addCls($api.byId('btnforgetsms'), 'disable-btn');
			$api.text($api.byId('btnforgetsms'),"" + curCount + "s");
			InterValObj = JInterval(SetRemainTime,1000);
			isrun = 1;
			
			var paramsObj = {
				app_key: kAppKey,
				mobile: mobile,
				deviceId: api.deviceId,
				sendtype: 1
			}
			var _sign = getSign(paramsObj, kAppKey, kAppSecret);
			paramsObj.signature = _sign;
			api.ajax({
				url: ApiUrl + '/v1/token/sendsms',
				method: 'post',
				data: {
					values: paramsObj
				}
			}, function(ret, err) {
				if (ret) {
					toast('验证码已发送');
				} else {
					toast(err.body.message);
					console.log(JSON.stringify(err));
				}
			});
			
		}
		function JInterval(funcName,time){
			   var args=[];
			   for(var i=2;i<arguments.length;i++){
				   args.push(arguments[i]);
			   }
			return window.setInterval(function(){
			 funcName.apply(this,args);
			},time);
		}
		   
		//timer处理函数
		function SetRemainTime() {
			if (curCount == 0) {                
				isrun = 0;
				window.clearInterval(InterValObj);//停止计时器
				//$api.removeAttr($api.byId('btnforgetsms'), 'disabled')
				$api.removeCls($api.byId('btnforgetsms'), 'disable-btn');
				$api.text($api.byId('btnforgetsms'),"重发验证码");
			}
			else {
				curCount--;
				$api.text($api.byId('btnforgetsms'),"" + curCount + "s");
			}
		}
		function login() {
			hideInput();//收起键盘
			var username = $api.val($api.byId('mobile'));
			var password = $api.val($api.byId('password'));
			var pwdtype = '密码';
			if(logintype==2)
			{
				pwdtype = '验证码';
			}
			else
			{
				if(password.length < 6 || password.length > 16)
				{
					toast("请输入6-16位密码");
					return false;
				}
			}
			if($api.cssVal($api.byId('login-btn'),'opacity')!=1)
			{
				return false;
			}
			if(username=='')
			{
				toast("请输入手机号");
				return false;
			}
			if(password=='')
			{
				toast("请输入"+pwdtype);
				return false;
			}
			showbtnloading('login-btn');
			
			var paramsObj = {
				app_key: kAppKey,
				mobile: username,
				password: password,
				logintype: logintype,
				platform: api.systemType
			}
			var _sign = getSign(paramsObj, kAppKey, kAppSecret);
			paramsObj.signature = _sign;
			console.log(JSON.stringify(paramsObj));
			api.ajax({
				url: ApiUrl + '/v1/token/mobile',
				method: 'post',
				data: {
					values: paramsObj
				}
			}, function(ret, err) {
				if (ret) {
					if(ret.data.client.status==4)
					{
						api.alert({ title: '账号无法登录', msg: '您的账户已禁用！' });
					}
					else if(ret.data.client.status==-1)
					{
						var access_token = ret.data.access_token;
						var rongcloud_token = ret.data.client.rongcloud_token;
						var credit = ret.data.client.credit;
						var userjson = {
							access_token : access_token,
							rongcloud_token: rongcloud_token,
							uid: ret.data.client.uid,
							realname: ret.data.client.realname,
							credit: credit,
							avatar: ret.data.client.avatar,
							mobile: ret.data.client.mobile,
							status: ret.data.client.status,
							usertype: ret.data.client.usertype
						};
						checkface(userjson);
						//未人脸识别的进行人脸识别
					}
					else
					{
						var access_token = ret.data.access_token;
						var rongcloud_token = ret.data.client.rongcloud_token;
						var credit = ret.data.client.credit;
						var userjson = {
							access_token : access_token,
							rongcloud_token: rongcloud_token,
							uid: ret.data.client.uid,
							realname: ret.data.client.realname,
							credit: credit,
							avatar: ret.data.client.avatar,
							mobile: ret.data.client.mobile,
							status: ret.data.client.status,
							usertype: ret.data.client.usertype
						};
						api.setPrefs({
							key: 'user_info',
							value: userjson
						}, function(ret, err) {
							//closeWin();
						});
						api.sendEvent({
							//刷新主页相关页面逻辑
							name : 'refreshindex',
							extra : {
								userjson : userjson
							}
						});
						api.sendEvent({
							name : 'updateuser',
							extra : {
								userjson : userjson
							}
						});
						api.closeToWin({
							name: 'root'
						});
					}
				} else {
					if(err.body.code == '405')
					{
						if(logintype == 2)
						{
							//返回405说明没注册，跳转设置密码页面
							var param = {
								mobile: username,
								vcode: password
							};
							openNavWin('#ddd','setpwd_win','setpwd_frm.html','',false,false,true,[],param);
						}
						else
						{
							//alert(JSON.stringify(err));
							toast(err.body.message);
						}
					}
					else
					{
						if(logintype == 1)
						{
							toast("密码不正确");
						}
						else
						{
							toast("验证码不正确");
						}
					}
					console.log(JSON.stringify(err));
				}
				hidebtnloading('login-btn','登录');
			});
		}
		function openUIinput(domid,placeholder_str,keyboardType,inputType,maxnum){
			//打开UIinput
			var password = $api.byId(domid);
			var password_rect = $api.offset(password);
			UIInput.open({
				rect: {
					x: password_rect.l,
					y: password_rect.t,
					w: password_rect.w,
					h: password_rect.h -1
				},
				styles: {
					bgColor: '#fff',
					size: 14,
					color: '#333',
					placeholder: {
						color: '#9f9f9f'
					}
				},
				autoFocus: false,
				maxRows: 1,
				placeholder: placeholder_str,
				keyboardType: keyboardType,
				inputType: inputType,
				fixedOn: api.frameName,
				fixed: false
			}, function(ret) {
				
				if (ret.eventType == 'change') {
					keyboardId = ret.id;
					UIInput.value({
							id: ret.id,
							//msg : '设置输入框的值'
					}, function(ret, err) {
						if (ret) {
							var _msg = ret.msg;
							if(maxnum > 0) {
								var _msglen = _msg.length;
								if(_msglen > maxnum)
								{
									_msglen = maxnum;
									_msg = ret.msg.substr(0,maxnum);
									UIInput.value({
										id: keyboardId,
										msg: _msg
									});
								}
							}
							$api.val(password,_msg);
						} else {
							//alert(JSON.stringify(err));
						}
					});
				} else if (ret.eventType == 'show' && domid == 'password') {
					curPwdinputId = ret.id; //获取验证码输入框ID
				} else {
					//alert(JSON.stringify(ret));
				}
			});
			
		}
		function hideInput(){
			//隐藏键盘
			UIInput.closeKeyboard({
				id: keyboardId
			});
		}
		function fnInitUIInput(){
			//计算位置
			openUIinput('mobile','请输入您的手机号','number','text',11);
			openUIinput('password','请输入至少6位密码','default','password',0);
		}
		function changeinput(){
			//切换输入框模块,关闭验证码输入框，打开密码输入框，或反之
			
			UIInput.close({
				id:curPwdinputId
			});
			var placeholder_str = '请输入至少6位密码';
			var keyboardType = 'default';
			var inputType = 'password';
			if(logintype == 2)
			{
				placeholder_str = '请输入验证码';
				keyboardType = 'number';
				inputType = 'text';
			}
			
			openUIinput('password',placeholder_str,keyboardType,inputType,0);
		}
		function closeWin(){
			api.closeWin({
			});
		}
		function checkface(userjson) {
			var pername = 'camera';
			var perdesc = '相机/拍照';
			
			if (api.systemType == "android") {
				if(pername == 'photos')
				{
					pername = 'storage';
				}
				if(!confirmPer(pername,perdesc,'')){
					return;
				}
			}
			//人脸识别
			var demo = api.require('baiduFaceLive');
			demo.openFaceDetectView({
				rect: {
					x: 0,
					y: 0,
					w : api.winWidth,
					h : api.winHeight,
				},
			
			}, function(ret, err){
				if(ret.evenType=='success'){
					//由于base64数据量大，请不要用JSON.stringify(ret)调试
					var paramsObj = {
						app_key: kAppKey,
						type: 'addface',
						uid: userjson.uid
					}
					var _sign = getSign(paramsObj, kAppKey, kAppSecret);
					paramsObj.base64str = 'data:image/jpeg;base64,'+ret.data.bestImage;
					paramsObj.signature = _sign;
					//console.log(JSON.stringify(paramsObj)+'!!!!!!');
					api.ajax({
						url: ApiUrl + '/v1/aips',
						method: 'post',
						data: {
							values: paramsObj
						}
					}, function(ret, err) {
						if (ret) {
							api.setPrefs({
								key: 'user_info',
								value: userjson
							}, function(ret, err) {
								//closeWin();
							});
							api.sendEvent({
								//刷新主页相关页面逻辑
								name : 'refreshindex',
								extra : {
									userjson : userjson
								}
							});
							api.sendEvent({
								name : 'updateuser',
								extra : {
									userjson : userjson
								}
							});
							api.closeToWin({
								name: 'root'
							});
						} else {
							toast(err.body.message);

						}
						demo.closeFaceDetectView(function(ret, err){
							//alert(JSON.stringify(ret));
						});
					});
					
					
					
					
				}else if(ret.evenType=='Tips'){
					toast(ret.message);
				}else{
					//api.showtoast("warning",{ msg : JSON.stringify(ret) +"  "+JSON.stringify(err)});
				}
			});
		}
		function selavatar(imgUrl) {
			$api.removeCls($api.dom('.footer'),'display-none');
			FNImageClip.open({
				rect: {
					x: 0,
					y: 0,
					w: api.winWidth,
					h: api.winHeight - document.querySelector('.footer').offsetHeight + api.safeArea.top + 45
				},
				srcPath: imgUrl,
				style: {
					mask: 'rgba(0,0,0,0.3)',
					clip: {
						w: 200,
						h: 200,
						x : (api.frameWidth - 200) / 2,
                        y : (api.frameHeight - 200) / 2,
						borderColor: '#0f0',
						borderWidth: 1,
						appearance: 'rectangle'
					}
				},
				mode: 'image'
			}, function(ret, err) {
				if (ret.status) {
					
					//alert(JSON.stringify(ret));
				} else {
					//alert(JSON.stringify(err));
				}
			});
		}
		function saveAndPost(){
			//裁剪成功开始处理，保存并上传
			
			api.showProgress({
				title: '请稍后...',
				text: '正在上传图片',
				modal: true
			});
			var imageCachePath = api.cacheDir;
			FNImageClip.save({
				destPath: imageCachePath+'/mylogo.png',
				copyToAlbum: false,
				quality: 1
			}, function(ret, err) {
				if (ret) {
					//alert(ret.destPath);
					var trans = api.require('trans');
					trans.decodeImgToBase64({
						imgPath: ret.destPath
					}, function(ret, err) {
						if (ret.status) {
							//转换成base64后上传
							//uploadpic('data:image/jpeg;base64,'+ret.base64Str);
							$api.byId('cardIDthumb0').src = 'data:image/jpeg;base64,'+ret.base64Str;
							var paramsObj = {
								base64str: 'data:image/jpeg;base64,'+ret.base64Str
							}
							uponeimg(paramsObj,'cardIDthumb_0');
						} else {
							api.hideProgress();
							//alert(JSON.stringify(err));
						}
					});
				} else {
					//alert(JSON.stringify(err));
				}
			});
		}
		function cancelPost() {
			$api.addCls($api.dom('.footer'),'display-none');
			FNImageClip.close(); //取消
		}
		function resetImg() {
			FNImageClip.reset(); //还原
		}
	</script>
</html>